<html>
<head><meta charset="utf-8"><title>how does rustc find libcore? · general · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/index.html">general</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/how.20does.20rustc.20find.20libcore.3F.html">how does rustc find libcore?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="203541466"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/how%20does%20rustc%20find%20libcore%3F/near/203541466" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> durin42 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/how.20does.20rustc.20find.20libcore.3F.html#203541466">(Jul 10 2020 at 18:23)</a>:</h4>
<p>I'm working on wiring up some bazel build rules and as part of that I'm trying to figure out how rustc finds libcore, and if I can influence that. Can anyone give me a kick in the right direction? (even if it's just to a more appropriate venue to ask an obscure question like this.)</p>



<a name="203545223"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/how%20does%20rustc%20find%20libcore%3F/near/203545223" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/how.20does.20rustc.20find.20libcore.3F.html#203545223">(Jul 10 2020 at 18:58)</a>:</h4>
<p><code>(rustc --print sysroot)/lib/rustlib/$TARGET/lib/</code></p>



<a name="203545249"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/how%20does%20rustc%20find%20libcore%3F/near/203545249" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/how.20does.20rustc.20find.20libcore.3F.html#203545249">(Jul 10 2020 at 18:58)</a>:</h4>
<p>Rustc looks at <code>$(rustc --print sysroot)/lib/rustlib/$TARGET_TRIPLE/lib</code> for sysroot crates. On nightly you can influence the sysroot location using <code>rustc --sysroot /path/to/sysroot</code>. On stable I think you can only use the default of  the parent dir of the <code>bin</code> dir that contains <code>rustc</code>.</p>



<a name="203546558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/how%20does%20rustc%20find%20libcore%3F/near/203546558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> durin42 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/how.20does.20rustc.20find.20libcore.3F.html#203546558">(Jul 10 2020 at 19:08)</a>:</h4>
<p>is there any specific naming required, or if i name it libcore.rlib will it be found?</p>



<a name="203546718"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/how%20does%20rustc%20find%20libcore%3F/near/203546718" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/how.20does.20rustc.20find.20libcore.3F.html#203546718">(Jul 10 2020 at 19:09)</a>:</h4>
<p>No specific name required I think. Why do you need this by the way? The default sysroot should work fine, right?</p>



<a name="203547725"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/how%20does%20rustc%20find%20libcore%3F/near/203547725" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> durin42 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/how.20does.20rustc.20find.20libcore.3F.html#203547725">(Jul 10 2020 at 19:17)</a>:</h4>
<p>It's complicated. There's an extant hackish system that's doing bazel in a one-off way that builds libcore et al from source as part of the design, and I'm trying to modify things as little as possible. Worst-case I can build from source and then check that in, but the long-term requirement is that we build everything from source (even rustc), so we'll see where that takes me. I'm still figuring out the lay of the land as I go on this though.</p>



<a name="203548260"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/how%20does%20rustc%20find%20libcore%3F/near/203548260" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/how.20does.20rustc.20find.20libcore.3F.html#203548260">(Jul 10 2020 at 19:22)</a>:</h4>
<p>hermetic compiler builds would require you to go to the last version supported by mrustc or even back to the original erlang rustc and bootstrap the whole chain.</p>



<a name="203548535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/how%20does%20rustc%20find%20libcore%3F/near/203548535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/how.20does.20rustc.20find.20libcore.3F.html#203548535">(Jul 10 2020 at 19:26)</a>:</h4>
<p>There was an erlang rustc?</p>



<a name="203548573"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/how%20does%20rustc%20find%20libcore%3F/near/203548573" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/how.20does.20rustc.20find.20libcore.3F.html#203548573">(Jul 10 2020 at 19:26)</a>:</h4>
<p>s/erlang/ocaml probably</p>



<a name="203548609"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/how%20does%20rustc%20find%20libcore%3F/near/203548609" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> durin42 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/how.20does.20rustc.20find.20libcore.3F.html#203548609">(Jul 10 2020 at 19:27)</a>:</h4>
<p>Yes (ocaml, not erlang) I'm aware of that, so I managed to talk our security folk off that ledge and down to "download once, but build new ones from source"</p>



<a name="203548650"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/how%20does%20rustc%20find%20libcore%3F/near/203548650" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> nagisa <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/how.20does.20rustc.20find.20libcore.3F.html#203548650">(Jul 10 2020 at 19:27)</a>:</h4>
<p>eeeh, my brain is fried ^^</p>



<a name="203548700"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/how%20does%20rustc%20find%20libcore%3F/near/203548700" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> durin42 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/how.20does.20rustc.20find.20libcore.3F.html#203548700">(Jul 10 2020 at 19:28)</a>:</h4>
<p>no worries :)</p>



<a name="203548789"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/how%20does%20rustc%20find%20libcore%3F/near/203548789" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/how.20does.20rustc.20find.20libcore.3F.html#203548789">(Jul 10 2020 at 19:29)</a>:</h4>
<p>mrustc will save a lot of time</p>



<a name="203548934"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/how%20does%20rustc%20find%20libcore%3F/near/203548934" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> durin42 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/how.20does.20rustc.20find.20libcore.3F.html#203548934">(Jul 10 2020 at 19:30)</a>:</h4>
<p>We're not building from source back to banging rocks together, we can use the currently-checked-in-rustc to build the next rustc</p>



<a name="203549060"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/how%20does%20rustc%20find%20libcore%3F/near/203549060" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/how.20does.20rustc.20find.20libcore.3F.html#203549060">(Jul 10 2020 at 19:31)</a>:</h4>
<p>By the way maybe somebody at google could help <span class="user-mention" data-user-id="295514">@John Hodge (Mutabah)</span> with 1.39 support in mrustc? :)</p>



<a name="203549568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/how%20does%20rustc%20find%20libcore%3F/near/203549568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> durin42 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/how.20does.20rustc.20find.20libcore.3F.html#203549568">(Jul 10 2020 at 19:36)</a>:</h4>
<p>While I'm (obviously?) not opposed to that, it's also largely moot because we've got 1.43 (I think) today, so once other yaks are shaven I'll easily upgrade to 1.44 using the 1.43 I already have</p>



<a name="203549869"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/how%20does%20rustc%20find%20libcore%3F/near/203549869" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> durin42 <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/how.20does.20rustc.20find.20libcore.3F.html#203549869">(Jul 10 2020 at 19:39)</a>:</h4>
<p>(this is largely equivalent to how we manage llvm/clang/etc, so that was an easy sell)</p>



<a name="203577273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/how%20does%20rustc%20find%20libcore%3F/near/203577273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/how.20does.20rustc.20find.20libcore.3F.html#203577273">(Jul 11 2020 at 03:02)</a>:</h4>
<p><span class="user-mention" data-user-id="316805">@durin42</span> I have some example code if you want to see it, for locally building libstd for a nightly (it does, however, require an existing libstd, because of the build scripts. so it's not really "from scratch" but rather done to remove sources of performance variance in the compiler's behavior)</p>



<a name="203577287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/how%20does%20rustc%20find%20libcore%3F/near/203577287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/how.20does.20rustc.20find.20libcore.3F.html#203577287">(Jul 11 2020 at 03:03)</a>:</h4>
<p>it's here: <a href="https://github.com/rust-lang/rustc-perf/blob/master/collector/src/bin/rustc-perf-collector/sysroot.rs#L53-L148">https://github.com/rust-lang/rustc-perf/blob/master/collector/src/bin/rustc-perf-collector/sysroot.rs#L53-L148</a></p>



<a name="203577330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/122651-general/topic/how%20does%20rustc%20find%20libcore%3F/near/203577330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/122651-general/topic/how.20does.20rustc.20find.20libcore.3F.html#203577330">(Jul 11 2020 at 03:04)</a>:</h4>
<p>oh it's kind of hacky, I just move all the <code>rlib</code> files into the right directory, I forgot about that</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>